<template>
  <view class="content">
    <view class="bgImg">
      <view class="card">
        <uni-card :is-shadow="true">
          <view class="title">Hello!欢迎登录</view>
          <u--form labelPosition="left" :model="userInfo" ref="uForm">
            <u-form-item label="用户名" labelWidth="60" prop="userName" borderBottom>
              <input v-model="userInfo.userName" />
            </u-form-item>
            <u-form-item label="密码" labelWidth="60" prop="passWord" borderBottom>
              <input password v-model="userInfo.passWord" />
            </u-form-item>
          </u--form>
          <u-button @tap="submit" type="primary" text="确定"></u-button>
        </uni-card>
      </view>
    </view>
    <u-toast ref="uToast"></u-toast>
  </view>
</template>

<script>
import request from '../../utils/request';
export default {
  data() {
    return {
      userInfo: {
        userName: '',
        passWord: '',
      },
    }
  },
  onLoad() {},
  methods: {
    submit() {
      if (!this.userInfo.userName || !this.userInfo.passWord) {
        this.$refs.uToast.show({
					message: '请输入用户名和密码',
					type: 'warning',
				})
        return
      }
      let obj = {
        PageIndex: 0,
        PageSize: 0,
        Data: {
          EquipmentCategory: "string",
          EquipmentType: this.userInfo.userName,
          Check1: 1,
          ProductNo: this.userInfo.userName,
          cboArea: "string",
          Check2: 0
        }
      }
      request.post('api/frmSchSumQry/GetUserData', obj).then(() => {
        uni.setStorageSync('username', this.userInfo.userName);
        uni.navigateTo({
          url: '/pages/index/index'
        });
      })
    }
  },
}
</script>
<style lang="scss" scoped>
.bgImg {
    width: 750rpx;
    height: 100vh;
    background-image: url('https://img-blog.csdnimg.cn/faf74bffd9ae400f9230ec2e9b85bdec.png');
    background-size: cover;
    background-repeat: no-repeat;
    .card {
        width: 90%;
        position: absolute;
        top: 20%;
        padding: 40rpx;
        .title {
            font-size: 36rpx;
            text-align: center;
            margin-bottom: 30rpx;
            margin-top: 30rpx;
        }
    }
}
</style>
